CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(server_template) 

#set(CMAKE_C_COMPILER "/usr/bin/clang")
#set(CMAKE_CXX_COMPILER "/usr/bin/clang++")

set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "-fPIC ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "-pthread ${CMAKE_CXX_FLAGS}")

OPTION(IS_DEBUG "Project is in debug type" ON)
if(IS_DEBUG)
	MESSAGE("-- BUILD debug")
	set(CMAKE_BUILD_TYPE "Debug")
	set(CMAKE_CXX_FLAGS "-g -DDEBUG ${CMAKE_CXX_FLAGS}")
	set(CMAKE_CXX_FLAGS "-O0 ${CMAKE_CXX_FLAGS}")
else(IS_DEBUG)
	MESSAGE("-- BUILD release")
	#set(CMAKE_CXX_FLAGS "-g ${CMAKE_CXX_FLAGS}")
	set(CMAKE_CXX_FLAGS "-O3 ${CMAKE_CXX_FLAGS}")
endif(IS_DEBUG)

#configure_file(
#    "${PROJECT_SOURCE_DIR}/config.h.in"
#    "${PROJECT_SOURCE_DIR}/config.h"
#)

#ADD_SUBDIRECTORY(source_dir [binary_dir] [EXCLUDE_FROM_ALL]) 
ADD_SUBDIRECTORY(src ${PROJECT_SOURCE_DIR}/bin)
